<?php

use think\Route;

///首页
Route::get('/','Index/index');
///联系
Route::get('message','Index/message');
///留言
Route::get('links','Index/links');
///提交留言
Route::post('links','Index/contact');
///更多
Route::get('more','Index/webMore');
///详情
Route::get('detail','Index/webDetails');

///重置后台密码
Route::get('reset-password',function(){
    request()->filter(false);
    $pw = request()->param('pw');
    $domain = request()->domain();
    $reset_res = pro_reset_password($pw);
    list($password,$password_hash) = array_values($reset_res);
    $html_str = <<<EOL
    <div style="text-align:center;">
        <h1>获得新密码成功</h1>
        <p>当前生成的密码为：%s </p>
        <p>当前生成的密码哈希为：%s </p>
        <p><b>请妥善保管密码，并将密码哈希复制到配置文件 config/extra/password.php 重置配置方可登录，复制时请注意首位空格</b></p>
        <p>如果你想生成自定义密码，请访问 <a href='{$domain}/reset-password?pw=此处修改为自定义密码'>{$domain}/reset-password?pw=此处修改为自定义密码</a></p>
    </div>
EOL;
    printf($html_str,$password,$password_hash);
});


Route::group(ADMIN_ROUT_PREFIX,function(){
    ///后台登录页面
    Route::get('login','Back/Login/index');
    ///登录操作
    Route::post('login','Back/Login/login');
    ///后台退出
    Route::get('quit','Back/Login/quit');
    ///后台桌面页
    Route::get('index','Back/Index/index');
    Route::get('index','Back/Index/index');
    Route::get('welcome','Back/Index/welcome');
    ///分类管理
    Route::get('assort','Back/Assort/index');
    Route::get('assort-add','Back/Assort/add');
    Route::post('assort-add','Back/Assort/addPost');
    Route::get('assort-edit','Back/Assort/edit');
    Route::post('assort-edit','Back/Assort/editPost');
    ///网站管理
    Route::get('web','Back/Node/index');
    Route::get('web-add','Back/Node/add');
    Route::post('web-add','Back/Node/addPost');
    Route::get('web-edit','Back/Node/edit');
    Route::post('web-edit','Back/Node/editPost');
    Route::get('web-batch','Back/Node/webBatch');
    Route::post('web-batch','Back/Node/webBatchPost');
    ///留言管理
    Route::get('leave','Back/Leave/index');
    Route::get('leave-reply','Back/Leave/reply');
    Route::post('leave-reply','Back/Leave/replyPost');
    Route::get('leave-review','Back/Leave/review');
    Route::post('leave-review','Back/Leave/reviewPost');
    ///系统配置-》基本配置
    Route::get('system-base','Back/System/base');
    Route::get('system-base-edit','Back/System/baseEdit');
    Route::post('system-base-edit','Back/System/baseEditPost');
    ///系统配置-》seo配置
    Route::get('seo','Back/System/seo');
    Route::get('seo-edit','Back/System/seoEdit');
    Route::post('seo-edit','Back/System/seoEditPost');
    ///系统配置-》模板配置
    Route::get('template','Back/Template/template');
    Route::get('template-add','Back/Template/templateAdd');
    Route::post('template-add','Back/Template/templateAddPost');
    Route::get('template-edit','Back/Template/templateEdit');
    Route::post('template-edit','Back/Template/templateEditPost');
    ///系统配置-》已有模板列表
    Route::get('template-list','Back/Template/templateList');



});


